package spider.main;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import spider.cmd.Cmd;
import spider.task.UpdateDataTask;

import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;


public class TZDataImport {
    private static Logger logger = LogManager.getLogger(TZDataImport.class);
    public static Map<String,Integer> companyDeviceMetricId = new HashMap<>();

    public static void main(String[] args) {
        Cmd.parserCmd(args);
        Timer timer = new Timer();
      /*  ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool( 1 );
        scheduledExecutorService.scheduleAtFixedRate( new UpdateDataTask(), 0,Cmd.times, TimeUnit.MINUTES );
        */logger.info("default start run and task executions per 5 min");
        timer.schedule(new UpdateDataTask(),0L,Cmd.times*60*1000L);
    }

}
